﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LLKanWebService.Model;
using LLKanWebService.BLL;
public partial class Login : System.Web.UI.Page
{
    UserManager usm = new UserManager();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["account"] != null)
            {
                Response.Write("login already");
            }
            else
            {
                string account = Request["account"].ToString();
                string passwrod = Request["password"].ToString();

                bool isRegister = usm.isRegister(account);
                if (isRegister)
                {
                    Users user = usm.findUserByAccount(account);
                    if (user.Passwrod == passwrod)
                    {
                        Session["account"] = account;
                        Response.Write("login successfully");
                    }
                    else
                    {
                        Response.Write("wrong password");
                    }
                }
                else
                {
                    Response.Write("wrong account");
                }
            }
        }
    }

}